package com.tron.dobest.java.tronnet.bio;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class TronNetServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(9200);
        Socket socket = serverSocket.accept();
        InputStream inputStream = socket.getInputStream();
        ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
        int read = -1;
        byte[] buff = new byte[1024];
        while ((read = inputStream.read(buff)) != -1) {
            arrayOutputStream.write(buff,0,read);
        }
        String string = arrayOutputStream.toString();
        System.out.println(string);
        inputStream.close();
        arrayOutputStream.close();
    }
}
